package td3.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

public class Contact {

	private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
	private String nom;
	private String mail;
	private String icone;
	
	public enum Property {
		NOM, MAIL, ICONE
	}
	
	public Contact() {
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public String getIcone() {
		return icone;
	}

	public void setIcone(String icone) {
		this.icone = icone;
	}

	@Override
	public String toString() {
		if (nom == null || nom.isEmpty()) {
			return "Nouveau contact";
		}
		return nom;
	}

	public void addPropertyChangeListener(PropertyChangeListener listener) {
		propertyChangeSupport.addPropertyChangeListener(listener);
	}

	public void removePropertyChangeListener(PropertyChangeListener listener) {
		propertyChangeSupport.removePropertyChangeListener(listener);
	}
}
